<!DOCTYPE html>
<html lang="en">
<!--header-->
<include file="Public:header"/>
<!--header-->

<section id="main-content">
    <section class="wrapper">
        <h3><i class="fa fa-angle-right"></i> 付费资讯</h3>
        <div class="row mt">
            <div class="col-md-12">
                <div class="content-panel">
                    <table class="table table-striped table-advance table-hover">
                        <h4><i class="fa fa-angle-right"></i> 付费资讯列表
                            <a href="{:U('news_form')}" class="btn btn-theme btn-default" style="margin-left: 40px">添加新资讯</a></h4>
                        <hr>
                        <thead>
                        <form class="form-inline" role="form" action="{:U('news_vip')}" method="post">
                            <select class="btn btn-theme04" name="sou"  style="width: 100px;float: left;margin-left: 20px;">
                                <option value="1">标题</option>
                                <option value="2">内容</option>
                            </select>
                            <div class="form-group" style="width: 300px;float: left;overflow: hidden;margin-left: 10px;margin-right: 10px">
                                <input type="text" name="content" class="form-control"  placeholder="请输入关键字" style="float: left;text-align: center">
                            </div>
                            <input type="submit" class="btn btn-theme" value="搜索" style="float: left" />
                        </form>
                        <tr>
                            <th>编号</th>
                            <th>展示图</th>
                            <th>价格</th>
                            <th>vip价格</th>
                            <th>咨询电话</th>
                            <th>标题</th>
                            <th>内容</th>
                            <!--<th>浏览量</th>-->
                            <th>修改时间</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <foreach name="list" item="v">
                            <tr>
                                <td>{$v.id}
                                    <if condition="$v.type eq 1">(资讯)</if><if condition="$v.type eq 2">(公告)</if>
                                </td>
                                <td>
                                    <if condition = "$v['img'] == NULL">
                                        <a class="fancybox" href="__PUBLIC__/img/wutu.png">
                                            <img class="img-responsive" src="__PUBLIC__/img/wutu.png" style="width: 60px;height: 60px;border-radius: 50%">
                                        </a>
                                        <else/>
                                        <a class="fancybox" href="{$v.img}">
                                            <img class="img-responsive" src="{$v.img}" style="width: 60px;height: 60px;border-radius: 50%">
                                        </a>
                                    </if>
                                </td>
                                <td>{$v.moneys}</td><td>{$v.vip_moneys}</td><td>{$v.phone}</td>
                                <td><input type="text" value="{$v.title}" title="{$v.title}"></td>
                                <td><input type="text" value="{$v.content}" title="{$v.content}"></td>
                                <!--<td>{$v.nums}</td>-->
                                <td><if condition="$v['up_at'] != 0">{$v.up_at|date="Y-m-d H:i:s",###}<else/>无</if></td>
                                <td>{$v.create_at|date="Y-m-d H:i:s",###}</td>
                                <td>
                                    <!--<a href="{:U('form',array('id'=>$v['id']))}" class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></a>-->
                                    <a  href="{:U('news_form',array('id'=>$v['id']))}" class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></a>
                                    <if condition="QUAN eq 2">
                                        <button onclick="del({$v.id},15)" class="btn btn-danger btn-xs"><i class="fa fa-trash-o"></i></button>
                                    </if>
                                </td>
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                    <form action="{:U('news_vip')}" method="post" name="frmss">
                        <div  style="margin: 0 auto;width: 800px;margin-bottom: 20px">
                            <if condition="$currpage == 1">
                                    <span class="badge" style="font-size: 15px">
                                        首页
                                    </span>
                                <span class="badge" style="font-size: 15px">
                                        上一页
                                    </span>
                                <else/>
                                <span class="badge" style="font-size: 15px">
                                        <a href="{:U('news_vip',array('currpage'=>1))}" style="color: #ffffff">首页</a>
                                    </span>
                                <span class="badge" style="font-size: 15px">
                                        <a href="{:U('news_vip',array('currpage'=>$currpage-1))}" style="color: #ffffff">上一页</a>
                                    </span>
                            </if>
                            <if condition="$currpage == $totalpage">
                                    <span class="badge" style="font-size: 15px">
                                        下一页
                                    </span>
                                <span class="badge" style="font-size: 15px">
                                        尾页
                                    </span>
                                <else/>
                                <span class="badge" style="font-size: 15px">
                                        <a href="{:U('news_vip',array('currpage'=>$currpage+1))}" style="color: #ffffff">下一页</a>
                                    </span>
                                <span class="badge" style="font-size: 15px">
                                        <a href="{:U('news_vip',array('currpage'=>$totalpage))}" style="color: #ffffff">尾页</a>
                                    </span>
                            </if>
                            <span class="badge" style="font-size: 15px">
                                    当前第 {$currpage} 页；共 {$totalpage} 页
                                </span>
                            <span class="badge" style="font-size: 15px">
                                    跳转到
                                <input type="text" name="currpage" style="width: 50px;height:18px;border-radius: 5px;color: black;text-align: center;margin-left: 4px;margin-right: 8px">页
                                <button id="tiao" style="color: #888888;width: 50px;height:18px;border-radius: 8px;margin: auto 0;border: none">确定</button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</section>

</section>
<!--footer-->
<include file="Public:footer"/>
<!--footer-->
<script type="text/javascript" src="__PUBLIC__/ui/lib/layer/2.4/layer.js"></script>
<script type="text/javascript">
    $(function() {
        //    fancybox
        jQuery(".fancybox").fancybox();
    });
</script>
<script>

    //custom select box
    $(function(){
        $('select.styled').customSelect();
    });
    //跳转页数检测
    $("#tiao").click(function () {
        if(document.frmss.currpage.value == "" || document.frmss.currpage.value > {$totalpage} || document.frmss.currpage.value < 1){
            return false;
        }
    })
    function del(id,type) {
        var currpage = "{$currpage}";
        if(id > 0){
            layer.confirm('确认要删除该内容？', {
                title: '删除提示：',
                btn: ['确定'] //可以无限个按钮
            }, function(index, layero){
                $.ajax({
                    type:"post",
                    data:{id:id,type:type},
                    url:"{:U('Del/del')}",
                    success:function (res) {
                        if(res.status == 1){
                            layer.open({
                                title: '',
                                content: "删除成功",
                            });
                            if(currpage == 1){
                                location.href="__APP__/Dashboard/News/news_vip";
                            }else{
                                location.href="__APP__/Dashboard/News/news_vip/currpage/"+currpage;
                            }
                        }
                        if(res.status == 2){
                            layer.open({
                                title: ''
                                ,content: "删除失败"
                            });
                            _pass = false;
                        }
                    }
                })
            });
        }
    }
</script>

</body>
</html>
